<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of createTableResults</title>
  <meta name="keywords" content="createTableResults">
  <meta name="description" content="CREATETABLERESULTS creates a JTable with the results of searching in DAS Registry">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">code</a> &gt; createTableResults.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for code&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>createTableResults
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>CREATETABLERESULTS creates a JTable with the results of searching in DAS Registry</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [tab]= createTableResults(dasXML,parentFig) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> CREATETABLERESULTS creates a JTable with the results of searching in DAS Registry
 
 SYNTAX: [tab]= createTableResults(dasXML,parentFig)
          dasXML - DAS XML from the server
          parentFig - handle for the parent graphical object
          tab - handle for the newly created uitable 

 See also <a href="searchRegistry_gui.html" class="code" title="function varargout = searchRegistry_gui(varargin)">SEARCHREGISTRY_GUI</a>

    DASMiner: DAS library and browser for Matlab.
    Diogo Veiga, March 2008.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="searchRegistry_gui.html" class="code" title="function varargout = searchRegistry_gui(varargin)">searchRegistry_gui</a>	SEARCHREGISTRY_GUI is the GUI for DAS Registry search in Browser</li></ul>
<!-- crossreference -->


<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [tab]= createTableResults(dasXML,parentFig)</a>
0002 <span class="comment">% CREATETABLERESULTS creates a JTable with the results of searching in DAS Registry</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% SYNTAX: [tab]= createTableResults(dasXML,parentFig)</span>
0005 <span class="comment">%          dasXML - DAS XML from the server</span>
0006 <span class="comment">%          parentFig - handle for the parent graphical object</span>
0007 <span class="comment">%          tab - handle for the newly created uitable</span>
0008 <span class="comment">%</span>
0009 <span class="comment">% See also SEARCHREGISTRY_GUI</span>
0010 <span class="comment">%</span>
0011 <span class="comment">%    DASMiner: DAS library and browser for Matlab.</span>
0012 <span class="comment">%    Diogo Veiga, March 2008.</span>
0013 
0014 
0015 <span class="keyword">try</span> 
0016     t_parseany = xml_parseany(dasXML);
0017 <span class="keyword">catch</span>
0018     msgbox(<span class="string">'Problem Parsing XML DAS Response'</span>,<span class="string">'Bad Parsing'</span>,<span class="string">'warn'</span>);
0019     tab = -1;
0020     <span class="keyword">return</span>;
0021 <span class="keyword">end</span>
0022 
0023 <span class="keyword">if</span> (~isfield(t_parseany,<span class="string">'SOURCE'</span>)) <span class="comment">%No matches</span>
0024    h = msgbox(<span class="string">'No Data sources found.'</span>,<span class="string">'Query results'</span>,<span class="string">'warn'</span>);
0025    movegui(h,<span class="string">'onscreen'</span>);
0026    tab = -1;
0027    <span class="keyword">return</span>;
0028 <span class="keyword">end</span>
0029 
0030 tab = uitable(size(t_parseany.SOURCE,2),5,parentFig);
0031 set(tab,<span class="string">'Visible'</span>,0);
0032 set(tab,<span class="string">'ColumnNames'</span>,{<span class="string">'ID'</span>, <span class="string">'Title'</span>, <span class="string">'Description'</span>, <span class="string">'Capabilities'</span>,<span class="string">'Source Details'</span>});
0033 set(tab,<span class="string">'Position'</span>,[20 20 675.45 200]);
0034 tab.setVisible(0);
0035 
0036 <span class="comment">%jt.AUTO_RESIZE_ALL_COLUMNS;</span>
0037 <span class="comment">%tModel.setValueAt('oi',2,2); %setValueAt(Object value, int row, int col)</span>
0038 <span class="comment">%table = tab.getTable; %physical attributes</span>
0039 
0040 tModel = tab.getTableModel; <span class="comment">%actual data</span>
0041 <span class="keyword">for</span> i=1:size(t_parseany.SOURCE,2)
0042    
0043     tModel.setValueAt(t_parseany.SOURCE{i}.ATTRIBUTE.uri,i-1,0);
0044     tModel.setValueAt(t_parseany.SOURCE{i}.ATTRIBUTE.title,i-1,1);
0045     tModel.setValueAt(t_parseany.SOURCE{i}.ATTRIBUTE.description,i-1,2);
0046     
0047     <span class="keyword">if</span> (isfield(t_parseany.SOURCE{i}.VERSION{1},<span class="string">'CAPABILITY'</span>))
0048 
0049         tokens = regexp(t_parseany.SOURCE{i}.VERSION{1}.CAPABILITY{1}.ATTRIBUTE.type,<span class="string">':'</span>,<span class="string">'split'</span>);
0050         capabilities = tokens{2};
0051     
0052         <span class="keyword">for</span> k=2:size(t_parseany.SOURCE{i}.VERSION{1}.CAPABILITY,2)
0053             tokens = regexp(t_parseany.SOURCE{i}.VERSION{1}.CAPABILITY{k}.ATTRIBUTE.type,<span class="string">':'</span>,<span class="string">'split'</span>);
0054             capabilities = strcat(capabilities,<span class="string">','</span>,tokens{2});
0055         <span class="keyword">end</span>
0056     <span class="keyword">end</span>
0057 
0058     tModel.setValueAt(capabilities,i-1,3);
0059     tModel.setValueAt(strcat(<span class="string">'http://www.dasregistry.org/showdetails.jsp?auto_id='</span>,t_parseany.SOURCE{i}.ATTRIBUTE.uri),i-1,4);
0060     
0061 <span class="keyword">end</span>
0062 
0063 tab.setRowHeight(20);
0064 tab.setColumnWidth(170);
0065</pre></div>
<hr><address>Generated on Tue 17-Feb-2009 16:59:45 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>